import{
  ajaxFun
  } from"../../utils/ajax"
Page({
   data:{
    banner:[],//轮播
    roll:[],//简报
    menus:[],//导航
    list:[],//优惠券
    skillList:[],//秒杀
    secKillResponse:{},//秒杀内容
    pinList:[],//拼团会
    totalPeople:"",

    duoList:[],
    hotList:[],
    firstList:[],
    newsList:[],
   },
  onLoad(){
    this.getData()
  },
  async getData(){
    let {banner,roll,menus}=await ajaxFun("/index","get") // 轮播图 公告  nav导航
    let{list}=await ajaxFun("/coupons","get")//优惠券
    let skillObj=await ajaxFun("/seckill/index","get")//秒杀
    let pinObj=await ajaxFun("/combination/index","get")//拼团会
    let kuanObj=await ajaxFun("/bargain/index","get")//砍价

    let duoObj=await ajaxFun("/index/product/1?page=1&limit=6","get")//多买热门
    let hotObj=await ajaxFun("/index/product/2?page=1&limit=6","get")//
    let firstObj=await ajaxFun("/index/product/3?page=1&limit=6","get")//
    let newsObj=await ajaxFun("/index/product/4?page=1&limit=6","get")//
   
    this.setData({
      banner,
      roll,
      menus,
      list,
      skillList:skillObj?skillObj.productList:[],
      secKillResponse:skillObj?skillObj.secKillResponse:[],
      pinList:pinObj.productList,
      totalPeople:pinObj.totalPeople,
      kuanList:kuanObj.productList,

      duoList:duoObj.list,
      hotList:hotObj.list,
      firstList:firstObj.list,
      newsList:newsObj.list,

    })
  },


})
